package cn.kimming.system.controller;

import cn.kimming.common.util.Result;
import cn.kimming.service.IChartService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 刘铭轩
 * date 2021-06-24
 */
@RestController
@RequestMapping("/chart")
public class ChartController {
    @Autowired
    private IChartService chartService;
    @GetMapping("/todayinfo")
    public Result getTodayInfo() {
        JSONObject info = chartService.getTodayInfo();
        return new Result(true, "查询成功").addData("info", info);
    }
    @GetMapping("/todayroomtypeleft")
    public Result getTodayRoomTypeLeft() {
        List<JSONObject> list = chartService.getTodayRoomTypeLeft();
        return new Result(true, "查询成功").addData("list", list);
    }

    @GetMapping("/recentordercounts")
    public Result getRecentOrderCounts() {
        List<JSONObject> list = chartService.getRecentOrderCounts();
        return new Result(true, "查询成功").addData("list", list);
    }
    @GetMapping("/monthtypeliverate")
    public Result getMonthTypeLiveRate() {
        List<JSONObject> list = chartService.getMonthTypeLiveRate();
        return new Result(true, "查询成功").addData("list", list);
    }
    @GetMapping("/monthorderamount")
    public Result getMonthOrderAmount() {
        List<JSONObject> list = chartService.getMonthOrderAmount();
        return new Result(true, "查询成功").addData("list", list);
    }
}
